/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.ylystudio.pms.ejb.entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Kenny Lin
 */
@Entity
@Table(name = "meeting_attend")
@NamedQueries({
    @NamedQuery(name = "MeetingAttend.findAll", query = "SELECT m FROM MeetingAttend m"),
    @NamedQuery(name = "MeetingAttend.findByMaId", query = "SELECT m FROM MeetingAttend m WHERE m.maId = :maId"),
    @NamedQuery(name = "MeetingAttend.findByMaType", query = "SELECT m FROM MeetingAttend m WHERE m.maType = :maType"),
    @NamedQuery(name = "MeetingAttend.findByMaIscome", query = "SELECT m FROM MeetingAttend m WHERE m.maIscome = :maIscome")})
public class MeetingAttend implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ma_id")
    private Integer maId;
    @Basic(optional = false)
    @Column(name = "ma_type")
    private String maType;
    @Column(name = "ma_iscome")
    private Integer maIscome;
    @JoinColumn(name = "user_id", referencedColumnName = "user_id")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private User user;
    @JoinColumn(name = "meet_id", referencedColumnName = "meet_id")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Meeting meeting;

    public MeetingAttend() {
    }

    public MeetingAttend(Integer maId) {
        this.maId = maId;
    }

    public MeetingAttend(Integer maId, String maType) {
        this.maId = maId;
        this.maType = maType;
    }

    public Integer getMaId() {
        return maId;
    }

    public void setMaId(Integer maId) {
        this.maId = maId;
    }

    public String getMaType() {
        return maType;
    }

    public void setMaType(String maType) {
        this.maType = maType;
    }

    public Integer getMaIscome() {
        return maIscome;
    }

    public void setMaIscome(Integer maIscome) {
        this.maIscome = maIscome;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public Meeting getMeeting() {
        return meeting;
    }

    public void setMeeting(Meeting meeting) {
        this.meeting = meeting;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (maId != null ? maId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof MeetingAttend)) {
            return false;
        }
        MeetingAttend other = (MeetingAttend) object;
        if ((this.maId == null && other.maId != null) || (this.maId != null && !this.maId.equals(other.maId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.ylystudio.pms.ejb.entity.MeetingAttend[maId=" + maId + "]";
    }

}
